import java.io.*;

/**
 * Created by 14229 on 2020/2/21.
 */
public class Test01 {
    public static void main(String[] args) throws IOException {

        File f = new File("模拟D盘");
        f.mkdir();
        File f1 = new File("模拟D盘/b.txt");
        f1.createNewFile();
        File f2 = new File("模拟D盘/c.txt");
        f2.createNewFile();
        File f3 = new File("模拟D盘/d.txt");
        f3.createNewFile();

        OutputStream os = new FileOutputStream(f1);
        os.write("abcdefg".getBytes());
        os.flush();
        os.close();
        System.out.println("字符串放入完毕");


        InputStream is1 = new FileInputStream(f1);
        OutputStream os1 = new FileOutputStream(f2);
        byte[] by1 = new byte[1024];
        int len1 = 0;
        while ((len1=is1.read(by1))!=-1){
            for (byte b : by1) {
                os1.write(b+3);
                os1.flush();
            }
        }
        is1.close();
        os1.close();


        InputStream is2 = new FileInputStream(f2);
        OutputStream os2 = new FileOutputStream(f3);
        byte[] by2 = new byte[1024];
        int len2 = 0;
        while ((len2=is2.read(by2))!=-1){
            for (byte b : by2) {
                os2.write(b-3);
                os2.flush();
            }
        }
        is2.close();
        os2.close();


    }
}
